Math functions
Math functions
FUNCTION | DESCRIPTION | SYNTAX |
---|---|---|
Abs | Returns the absolute value of a number (integer, currency, real, float). Abs(1.5) -> 1.5 Abs(-1.5) -> 1.5 The parameter can be XPath, variable, or number. | CHelper.Math.Abs(Number) |
Average | Obtains the average (arithmetic mean) of a set of numbers (integer, currency, real, float). The parameters can be XPaths, variables, or numbers, and have to be between brackets. | CHelper.Math.Average([Number1, Number2, ......]) |
Ceiling | Rounds a number (integer, currency, real, float) up to the nearest integer. Ceiling(1.2) -> 2 Ceiling(1.9) -> 2 The parameter can be XPath, variable, or number. | CHelper.Math.Ceiling(Number) |
Exp | Returns e (the base of natural logarithms) raised to the given power. The parameter can be XPath, variable, or number. THE RESULT OF THIS FUNCTION MUST BE STORED IN A FLOAT-TYPE ATTRIBUTE. | CHelper.Math.Exp(Number) |
Floor | Rounds a number (integer, currency, real, float) down to the nearest integer. Floor(1.2) -> 1 Floor(1.9) -> 1 The parameter can be XPath, variable, or number. | CHelper.Math.Floor(Number) |
IsNaN | This function checks if a parameter is not a number: • Returns true if the parameter is not a number. • Returns false if the parameter is a number. The parameter can be XPath, variable, or number. | CHelper.Math.IsNaN(Parameter) |
Ln | Returns the natural logarithm of a number (integer, currency, real, float). The parameter can be XPath, variable, or number. | CHelper.Math.Ln(Number) |
Log10 | Returns the base 10 logarithm of a number. The parameter can be XPath, variable, or number. | CHelper.Math.Log10(Number) |
Max | Returns the largest value of a set of numbers (integer, currency, real, float). The parameters can be XPaths, variables, or numbers, and have to be between brackets. | CHelper.Math.Max([Number1, Number2]) |
Min | Returns the smallest value of a set of numbers (integer, currency, real, float). The parameters can be XPaths, variables, or numbers, and have to be between brackets. | CHelper.Math.Min([Number1, Number2]) |
Module | Returns the remainder after a number is divided by a divisor. Mod(8,3) -> 2 Mod(10,2) -> 0 The parameters can be XPaths, variables, or numbers and must be integers. | CHelper.Math.Module(Number, Divisor) |
Percentage | Returns the equivalent in percentage of a number (integer, currency, real, float). Percentage(100) -> 1 Percentage(75) -> 0.75 The parameter can be XPath, variable, or number. | CHelper.Math.Percentage(Number) |
Pow | Obtains the result of a number raised to a power. The parameters can be XPaths, variables, or numbers. | CHelper.Math.Pow(Base, Power) |
Quotient | Returns the integer portion of a division. Quotient(100,3) -> 33 Quotient(5,2) -> 2 The parameters can be XPaths, variables, or numbers and must be integers. | CHelper.Math.Quotient(Number, Divisor) |
Rand(from,to) | Returns an integer random number between two numbers. The parameters can be XPaths, variables, or numbers and must be integers. | CHelper.Math.Rand(ValueFrom, ValueTo) |
Rand | When the function has empty parameters it returns a decimal random number between 0.0 to 1.0. | CHelper.Math.Rand() |
Round(number, decimal) | Reduces a given number (integer, currency, real, float) to a specific number of decimal places (integer). Round(1.247, 2) -> 1.25 Round(1.534, 1) -> 1.5 The parameters can be XPaths, variables, or numbers. | CHelper.Math.Round(Number, DecimalPlaces) |
Round(number) | Reduces a given number (integer, currency, real, float) to an integer without decimal places. Round(1.247) -> 1 Round(1.534) -> 2 The parameters can be XPaths, variables, or numbers. | CHelper.Math.Round(Number) |
Sqrt | Obtains the square root of a number (integer, currency, real, float). | CHelper.Math.Sqrt(Number) |
Truncate | Truncates a number (integer, currency, real, float) to an integer by removing its decimal or fractional part. Truncate(35.5) -> 35 Truncate(35.89) -> 35 The parameter can be XPath, variable, or number. | CHelper.Math.Truncate(Number) |